﻿@model DLULearningNetwork.ViewModels.CourseMembersViewModel
@using DLULearningNetworkModel
@using DLULearningNetwork.Libs;
@{
    bool isOwner = false;
    if (Course.Single(DLULearningNetwork.Controllers.FrontEndBaseController.LoginUser.AccountID_u, Model.CourseID) != null)
    {
        isOwner = true;
    }
}
<script type="text/javascript">
    $(document).ready(function () {
        Member.init();
    });
</script>
@if (isOwner)
{    
<div style="float:left;"><span class="invite_icon32" style="cursor: pointer;">Mời bạn tham gia lớp học</span></div>
<div style="float: right;">
    <div style="float: right; margin-right: 10px;">
        <span class="cancel_icon32" style="cursor: pointer;">Từ chối</span>
    </div>
    <div style="float: right; margin-right: 10px;">
        <span class="accept_icon32" style="cursor: pointer;">Phê duyệt</span>
    </div>
</div>
<div class="clearall">
</div>
}
<div class="membercontainer">
    <div class="loading"></div>
    <table class="tbl1" cellpadding="0" cellspacing="0">
        <tr>
            <th style="text-align:left;">
                Nickname
            </th>
            <th style="text-align:left;">
                Tên
            </th>
            <th style="text-align:left;">
                Trạng thái
            </th>
            <th style="width: 50px;">
            </th>
        </tr>
        @for (int i = 0; i < Model.Enrollments.Count; i++)
        {
            Account account = Account.Single(Model.Enrollments[i].AccountID_u);
            if (account != null)
            { 
            <tr style="height:55px;">
                <td><a href="/UserPage/UserHome/@account.Nickname_s"><img src="@StringHelper.GetImageUrl(account.Avatar_s,1)" style="vertical-align:middle; width:40px;height:40px;" /> @account.Nickname_s</a>
                </td>
                <td>@account.LastName_s @account.FirstName_s
                </td>
                <td>
                    @switch (Model.Enrollments[i].Status_i)
                    {
                        case 0:
                        <span>Đang chờ</span>
                            break;
                        case 1:
                        <span>Đã phê duyệt</span>
                            break;
                        case 2:
                        <span>Đã từ chối</span>
                            break;
                        case 3:
                        <span>Đang y/cầu t/gia</span>    
                            break;
                    }
                </td>
                <td style="text-align: center;">
                    @if (isOwner && Model.Enrollments[i].Status_i != 3)
                    {
                    <input type="checkbox" enrollmentID="@Model.Enrollments[i].EnrollmentID_u" />
                    }
                </td>
            </tr>
            }
        }
    </table>
</div>
